/**
 * This chapter gives an overview of the widgets modules.
 * It will cover widgets properties, the inheritance scheme that is used in widgets, and also the parenting system.
 * Now that we have our button, we may want to customize it a bit.
 */

#include <QApplication>
#include <QPushButton>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QPushButton button;
    button.setText("My text");
    button.setToolTip("A tooltip");
    button.show();

    // 设置字体
    QFont font ("Courier");
    button.setFont(font);

    // 设置图标
    // And you can create an icon provided that it has an absolute (or relative) path in the filesystem.
    // I recommend providing the absolute path in this example.
    // But for deployment considerations, you might use the relative path, or better, the resource system.
    QIcon icon ("://Resources/images/clock_32x32.png");
    button.setIcon(icon);

    // 按系统风格设置图标
    // On Linux, and some other OS's, there is a convenient way to set an icon from an icon theme.
    // It can be done by using the static method:
    // QIcon Qicon::fromTheme ( const QString &name, const QIcon &fallback = QIcon());

    // For example, in the screenshot at the beginning of this chapter, the smiley comes from the Oxygen KDE icon theme and was set by:
    // button.setIcon(QIcon::fromTheme("face-smile"));
    return a.exec();
}
